package riceSystem.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import riceSystem.dao.DaoTemplateInterface;
import riceSystem.entity.Administrator;
import riceSystem.exception.RunException;
import riceSystem.service.ServiceTemplateInterface;

/**
 * 管理员service
 * 
 * @author zhangyi
 * 
 */
@Component("administratorService")
public class AdministratorServiceImpl implements ServiceTemplateInterface<Administrator> {

	private DaoTemplateInterface<Administrator> administratorDao;

	public DaoTemplateInterface<Administrator> getAdministratorDao() {
		return administratorDao;
	}

	@Resource(name = "administratorDao")
	public void setAdministratorDao(
			DaoTemplateInterface<Administrator> administratorDao) {
		this.administratorDao = administratorDao;
	}

	public void add(Administrator t) throws RunException {
		administratorDao.save(t);
	}

	public void removeById(long id) throws RunException {
		administratorDao.deleteById(id);
	}

	public void remove(Administrator t) throws RunException {
		administratorDao.delete(t);
	}

	public long update(Administrator t) throws RunException {
		return administratorDao.update(t);
	}

	public Administrator getById(long id) throws RunException {
		return administratorDao.loadById(id);
	}

	public List<Administrator> getAll() throws RunException {
		return administratorDao.loadAll();
	}
}
